home *** CD-ROM | disk | FTP | other *** search
- /****i* SOURCE_FILE/INFO
- *
- * NAME
- * Messages.js
- *
- * USAGE
- * Part of Netobjects JavaScript Library.
- *
- * COPYRIGHT
- * Copyright ⌐ 2000-2005 Website Pros, Inc.
- * All Rights Reserved.
- *
- * This is an unpublished work protected by Website Pros, Inc.
- * as a trade secret, and is not to be used or disclosed except as
- * expressly provided in a written license agreement executed by
- * you and Website Pros, Inc.
- *
- * <copyright@websitepros.com>
- *
- * NOTES
- * JavaScript code.
- *
- *****/
-
- if (!IS.isModuleInitialized("IS.NOF.DIALOGS.Messages"))
- {
-
- /****h* NOF_JavaScript_Library/NOF.DIALOGS.Messages
- *
- * NAME
- * NOF.DIALOGS.Messages
- *
- * DESCRIPTION
- *
- * The <code>Messages</code> class
- * External dependencies: NOF.App, NOF.UTIL.PropertyResourceBundle
- ****/
-
- /**
- * constructor
- **/
- function Messages() {
- this.__proto__ = Messages.prototype;
- this.installedPath = null;
- }
- {
- var members = Messages.prototype;
-
- members.TITLE = "TITLE";
- members.TEXT = "TEXT";
- members.MODE = "MODE";
- members.INCLUDE_SKIP = "INCLUDE_SKIP";
- members.SKIP_KEY = "SKIP_KEY";
- members.SKIP_KEY_LABEL = "SKIP_KEY_LABEL";
- members.DETAILED_ALERTS = "DETAILED_ALERTS";
- members.FEEDBACK_CONFIRM= "FEEDBACK_CONFIRM";
- members.SIZE_WIDTH = "SIZE_WIDTH";
- members.SIZE_HEIGHT = "SIZE_HEIGHT";
- members.BUTTON_OK = "BUTTON_OK";
- members.BUTTON_CANCEL = "BUTTON_CANCEL";
-
- members.QUESTION = "QUESTION";
- members.WARNING = "WARNING";
- members.INFO = "INFO";
- members.NONE = "NONE";
-
- members.IMAGE_NAME = {
- QUESTION : "questionmark.gif",
- WARNING : "error.gif",
- INFO : "exclamation.gif",
- NONE : "pix.gif"
- }
-
- //members.NOF_LABEL = "NetObjects Fusion";
- members.defaultProperties = null;
-
- var method = Messages.prototype;
- /**
- * prompt
- * @param message text to be showed
- * @param defaultValue default value entered in the edit field.
- * @param title dialog title.
- * @param yesButtonLabel label for the first button (OK, Yes)
- * @param noButtonLabel label for the second button (Cancel, No). If null,
- * the button will not be displayed.
- * @param wnd window object (will be the parent of the new opened Messages dialog)
- * @param width dialog with (in pixels)
- * @param height dialog height (in pixels)
- **/
- method.prompt = function (message, defaultValue, title, yesButtonLabel, noButtonLabel, wnd, width, height) {
- //(message, mode, detailedMessage, askAgainVar, askAgainLabel, title, yesButtonLabel, noButtonLabel, wnd, width, height, defaultFeedbackValue)
- return this.messageBox(message, this.NONE, null, null, null, title, yesButtonLabel, noButtonLabel, wnd, width, height, defaultValue);
- }
-
- /**
- * confirm
- * @param message text to be showed
- * @param askAgainVar a unique name to identify this message
- * @param askAgainLabel text to be displayed next to the checkbox
- * (something like "Do not show this message again")
- * @param title dialog title.
- * @param yesButtonLabel label for the first button (OK, Yes)
- * @param noButtonLabel label for the second button (Cancel, No).
- * If null, the button will not be displayed.
- * @param wnd window object (will be the parent of the new opened Messages dialog)
- * @param width dialog with (in pixels)
- * @param height dialog height (in pixels)
- **/
- method.confirm = function (message, askAgainVar, askAgainLabel, title, yesButtonLabel, noButtonLabel, wnd, width, height) {
- return this.messageBox(message, this.QUESTION, null, askAgainVar, askAgainLabel, title, yesButtonLabel, noButtonLabel, wnd, width, height);
- }
-
- /**
- * info
- * @param message text to be showed
- * @param askAgainVar a unique name to identify this message
- * @param askAgainLabel text to be displayed next to the checkbox
- * (something like "Do not show this message again")
- * @param title dialog title.
- * @param buttonLabel label for the 'Close window' button (OK, Yes)
- * @param wnd window object (will be the parent of the new opened Messages dialog)
- * @param width dialog with (in pixels)
- * @param height dialog height (in pixels)
- **/
- method.info = function (message, askAgainVar, askAgainLabel, title, buttonLabel, wnd, width, height) {
- this.messageBox(message, this.INFO, null, askAgainVar, askAgainLabel, title, buttonLabel, null, wnd, width, height);
- }
-
- /**
- * warning
- * @param message text to be showed
- * @param askAgainVar a unique name to identify this message
- * @param askAgainLabel text to be displayed next to the checkbox
- * (something like "Do not show this message again")
- * @param title dialog title.
- * @param yesButtonLabel label for the first button (OK, Yes)
- * @param noButtonLabel label for the second button (Cancel, No).
- * If null, the button will not be displayed.
- * @param wnd window object (will be the parent of the new opened Messages dialog)
- * @param width dialog with (in pixels)
- * @param height dialog height (in pixels)
- **/
- method.warning = function (message, askAgainVar, askAgainLabel, title, yesButtonLabel, noButtonLabel, wnd, width, height) {
- return this.messageBox(message, this.WARNING, null, askAgainVar, askAgainLabel, title, yesButtonLabel, noButtonLabel, wnd, width, height);
- }
-
- /**
- * alert
- * @param message text to be showed
- * @param title dialog title.
- * @param buttonLabel label for the 'Close window' button (OK, Yes)
- * @param wnd window object (will be the parent of the new opened Messages dialog)
- * @param width dialog with (in pixels)
- * @param height dialog height (in pixels)
- **/
- method.alert = function (message, title, buttonLabel, wnd, width, height) {
- this.messageBox(message, this.INFO, null, null, null, title, buttonLabel, null, wnd, width, height);
- }
-
- /**
- * Show error/warning details in a textarea.
- * @param message text to be showed
- * @param errorList Array of detailed messages.
- * @param title dialog title.
- * @param buttonLabel label for the 'Close window' button (OK, Yes)
- * @param wnd window object (will be the parent of the new opened Messages dialog)
- * @param width dialog with (in pixels)
- * @param height dialog height (in pixels)
- */
- method.detailedAlert = function (message, errorList, title, buttonLabel, wnd, width, height) {
- this.messageBox(message, this.INFO, errorList.join("\r\n"), null, null, title, buttonLabel, null, wnd, width, height);
- }
-
- method.messageBox = function (message, mode, detailedMessage, askAgainVar, askAgainLabel, title, yesButtonLabel, noButtonLabel, wnd, width, height, defaultFeedbackValue) {
-
- if ( (askAgainVar != null) && (NOF.App.getVariable(askAgainVar) == 'true') ) {
- //alert("user said do not show this message again. "+askAgainVar);
- return true;
- }
-
- if (this.installedPath == null) {
- this.installedPath = NOF.App.getSystemDirectory() + "/FSI/lib/nof/dialogs/";
- //alert("installedPath "+this.installedPath);
- }
-
- var args = new Array();
- args[0] = NOF;
-
- var propObj = new NOF.UTIL.PropertyResourceBundle("Messages.messageBox");
- propObj.setProperty(this.TITLE, title || this.getDefaultProperty("label.defaultTitle"));
- propObj.setProperty(this.TEXT, message);
- propObj.setProperty(this.MODE, mode);
- if (detailedMessage != null) {
- propObj.setProperty(this.DETAILED_ALERTS, detailedMessage);
- }
- if (askAgainVar != null) {
- propObj.setProperty(this.INCLUDE_SKIP, "true");
- propObj.setProperty(this.SKIP_KEY, askAgainVar);
- propObj.setProperty(this.SKIP_KEY_LABEL, askAgainLabel);
- }
- if (yesButtonLabel != null) {
- propObj.setProperty(this.BUTTON_OK, yesButtonLabel);
- }
- if (noButtonLabel != null) {
- propObj.setProperty(this.BUTTON_CANCEL, noButtonLabel);
- }
-
- propObj.setProperty(this.SIZE_WIDTH, width);
- propObj.setProperty(this.SIZE_HEIGHT, height);
-
- if (defaultFeedbackValue != null) {
- propObj.setProperty(this.FEEDBACK_CONFIRM, defaultFeedbackValue);
- }
-
- //propObj.setProperty(this., );
-
- args[1] = propObj;
-
- var wndw = (wnd != null) ? wnd : window;
- var res = wndw.showModalDialog(this.installedPath + "MessageBoxDlg.html", args,
- "status:no;help:no;border:thin;dialogWidth:" + width + "px;dialogHeight:"+ height + "px;center:yes;scroll:no;");
-
- //cleaning up explicitely some vars
- propObj = null;
-
- return res;
-
- }
-
- method.getDefaultProperty = function getDefaultProperty(propertyName) {
- if (this.defaultProperties == null) {
- this.defaultProperties = NOF.UTIL.ResourceBundle.getBundle("lib/nof/dialogs/DlgResources");
- }
-
- return (this.defaultProperties != null) ? this.defaultProperties.getProperty(propertyName) : propertyName;
- }
- }
- // add Messages to DIALOGS namespace
- DIALOGS.__proto__.Messages = new Messages();
- }
-
-